package cn.marinda.resturants.mapper;

import cn.marinda.resturants.entity.Bill;
import cn.marinda.resturants.global.Pages;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.context.annotation.Primary;

import java.math.BigDecimal;
import java.util.List;

/** 账单mapper
 * @date 2021/11/16
 * @author Marinda
 *
 */
public interface BillMapper extends BaseMapper<Bill> {

    /** 查询所有type属性下的账单
     *
     * @param type 属性类型
     * @return 集合类型
     */
    @Select("select * from r_bill where type = #{type}")
    List<Bill> selectTypeList(String type);

    /** number数
     *
     * @param adminUid
     * @return
     */
    @Select("select number from r_bill where admin_uid = #{adminUid}")
    BigDecimal selectBillNumber(String adminUid);


    /** 查询一个管理员的帐单列表
     *
     * @param admin_uid
     * @return
     */
    @Select("select * from r_bill where admin_uid = #{admin_uid}")
    List<Bill> selectAdminUidList(String admin_uid);

    /** 进行账单分页
     *
     * @param pages 分页
     * @return 分页结果
     */
    @Select("select * from r_bill")
    IPage<Bill> selectBillPage(Pages<?> pages);
}
